<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic xml:lang="en" id="topic1">
  <title>pg_user_mappings</title>
  <body>
    <p>The <codeph>pg_user_mappings</codeph> view provides access to information about user
       mappings. This view is essentially a public-readble view of the <codeph>pg_user_mapping</codeph>
       system catalog table that omits the options field if the user does not have access rights
        to view it.</p>
    <table id="table_zgy_xfx_tz">
      <title>pg_user_mappings</title>
      <tgroup cols="4">
        <colspec colnum="1" colname="col1" colwidth="131pt"/>
        <colspec colnum="2" colname="col2" colwidth="86pt"/>
        <colspec colnum="3" colname="col3" colwidth="85pt"/>
        <colspec colnum="4" colname="col4" colwidth="147pt"/>
        <thead>
          <row>
            <entry colname="col1">column</entry>
            <entry colname="col2">type</entry>
            <entry colname="col3">references</entry>
            <entry colname="col4">description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry colname="col1"><codeph>umid</codeph></entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_user_mapping.oid</entry>
            <entry colname="col4">OID of the user mapping.</entry>
          </row>
          <row>
            <entry colname="col1"><codeph>srvid</codeph></entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_foreign_server.oid</entry>
            <entry colname="col4">OID of the foreign server that contains this mapping.</entry>
          </row>
          <row>
            <entry colname="col1"><codeph>srvname</codeph></entry>
            <entry colname="col2">text</entry>
            <entry colname="col3">pg_foreign_server.srvname</entry>
            <entry colname="col4">Name of the foreign server.</entry>
          </row>
          <row>
            <entry colname="col1"><codeph>umuser</codeph></entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_authid.oid</entry>
            <entry colname="col4">OID of the local role being mapped, 0 if the user mapping is public.</entry>
          </row>
          <row>
            <entry colname="col1"><codeph>usename</codeph></entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"></entry>
            <entry colname="col4">Name of the local user to be mapped.</entry>
          </row>
          <row>
            <entry colname="col1"><codeph>umoptions</codeph></entry>
            <entry colname="col2">text[]</entry>
            <entry colname="col3"></entry>
            <entry colname="col4">User mapping-specific options, as "keyword=value" strings.</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <p>
      To protect password information stored as a user mapping option, the
      <codeph>umoptions</codeph> column reads as null unless one of the following
      applies:</p> <ul>
        <li>The current user is the user being mapped, and owns the server or holds
          <codeph>USAGE</codeph> privilege on it.</li>
        <li>The current user is the server owner and the mapping is for
          <codeph>PUBLIC</codeph>.</li>
        <li>The current user is a superuser.</li>
      </ul>
  </body>
</topic>
